<?php
class Member extends CI_Controller
{
	public function validate_login(){
		
		$username = $this->input->post('username');
		$password = $this->input->post('password');
		
		$this->load->model('Member_model');
		$member = $this->Member_model->validate_login($username, $password);
		
		if($member)
		{
			if($member['username'] == $username)
			{
				$array_sess = array(
					'memid' => $member['memid'],
					'username' => $member['username'],
					'name' => $member['name'],
					'surname' => $member['surname'],
					'type' => $member['type'],
					'psumember' => $member['psumember'],
					'email' => $member['email']
				);
				$this->session->set_userdata($array_sess);
				
				echo 'Y';
			}
			
		}
	}
	
	public function logout()
	{
		$this->session->sess_destroy();
		redirect('main/index');
	}
	
}